home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 1992 August
/
info-mac-1992.iso
/
Applications (app)
/
Image 1.44
/
Macros
/
Gel Plotting Macros
< prev
next >
Wrap
Text File
|
1992-02-26
|
4KB
|
166 lines
var {Global variables}
RoiLeft,RoiTop,RoiWidth,RoiHeight,PlotColor:integer;
GelWidth,GelHeight,MaxPlotWindowHeight:integer;
GelWindow,PlotWindow,PlotLeft,PlotTop,PlotWidth,PlotHeight:integer;
hMargin,vMargin,nLanes,SavePlotTop:integer;
LeftMargin,TopMargin,RightMargin,BottomMargin:integer;
FirstBackgroundPlot:boolean;
macro 'Setup to Plot Gel [Z]';
{This macro, along with the Plot Lane macro, is used to generate profile}
{plots of the lanes in a one dimensional electoproretic gel.}
var
nPixels,mean,mode,min,max:real;
PlotWinHeight:integer;
begin
PlotHeight:=175;
PlotWidth:=500;
MaxPlotWindowHeight:=720;
GetRoi(RoiLeft,RoiTop,RoiWidth,RoiHeight);
if RoiWidth=0 then begin
PutMessage('The Setup macro expects the Gel to be displayed and the first lane outlined.');
exit;
end;
if PlotWidth<RoiWidth then PlotWidth:=RoiWidth;
if PlotWidth>(2*RoiWidth) then PlotWidth:=2*RoiWidth;
if RoiHeight>RoiWidth then begin
PutMessage('Lanes must be horizontal.');
exit;
end;
if nPics<>1 then begin
PutMessage('The window containing the gel should be the only image window open.');
exit;
end;
nLanes:=GetNumber('Number of lanes?',1);
GetPicSize(GelWidth,GelHeight);
MakeRoi(RoiLeft,RoiTop,RoiWidth,GelHeight-RoiTop);
Measure;
GetResults(nPixels,mean,mode,min,max);
hMargin:=5;
vMargin:=5;
if Calibrated
then LeftMargin:=35
else LeftMargin:=25;
TopMargin:=10;
RightMargin:=10;
BottomMargin:=20;
PlotLeft:=hMargin-LeftMargin;
PlotTop:=vMargin-TopMargin;
SavePlotTop:=PlotTop;
PlotWinHeight:=nLanes*PlotHeight+2*vMargin;
if PlotWinHeight>MaxPlotWindowHeight then begin
PlotWinHeight:=MaxPlotWindowHeight;
PlotHeight:=(PlotWinHeight-2*vMargin)/nLanes;
end;
SetNewSize(PlotWidth+2*hMargin,PlotWinHeight);
SetForegroundColor(255);
SetBackgroundColor(0);
MakeNewWindow('Plots');
SetPlotSize(PlotWidth,PlotHeight);
min:=min-1;
if min<0 then min:=0;
max:=max+5;
if max>255 then max:=255;
SetPlotScale(cValue(min),cValue(max));
SetPlotLabels(false);
GelWindow:=1;
PlotWindow:=2;
SelectPic(GelWindow);
MakeRoi(RoiLeft,RoiTop,RoiWidth,RoiHeight);
FirstBackgroundPlot:=true;
PlotColor:=1;
ResetCounter;
MeasureArea(true);
MeasureDensity(false);
WandAutoMeasure(true);
AdjustAreas(true);
LabelParticles(false);
IncludeInteriorHoles(true);
SetFontSize(9);
SetText('Centered');
SetLineWidth(1);
end;
macro 'Plot Lane [P]';
var
left,top,width,height:integer;
begin
if (GelWidth=0) or (nPics=1) then begin
PutMessage
('Before using the Plot Lane macro you must first use the Setup macro.');
Exit;
end;
GetRoi(left,top,width,height);
MakeRoi(RoiLeft,top,RoiWidth,RoiHeight);
SetOption;
ColumnAveragePlot;
Copy;
SelectPic(PlotWindow);
MakeRoi(PlotLeft,PlotTop,PlotWidth+LeftMargin+RightMargin,
PlotHeight+TopMargin+BottomMargin);
Paste;
DoOr;
PlotTop:=PlotTop+PlotHeight-1;
SelectPic(GelWindow);
end;
macro 'Plot Background Lane [B]';
{Plot all lanes before plotting backgrounds. Unlike the lane plotting macro,}
{you are allowed to change the height of the selection.}
var
left,top,width,height:integer;
begin
if (GelWidth=0) or (nPics=1) then begin
PutMessage('Use Setup first.');
Exit;
end;
GetRoi(left,top,width,height);
MakeRoi(RoiLeft,top,RoiWidth,height);
ColumnAveragePlot;
Copy;
SelectPic(PlotWindow);
if FirstBackgroundPlot then begin
FirstBackgroundPlot:=false;
PlotTop:=SavePlotTop;
end;
MakeRoi(PlotLeft,PlotTop,PlotWidth+LeftMargin+RightMargin,
PlotHeight+TopMargin+BottomMargin);
Paste;
DoOr;
PlotTop:=PlotTop+PlotHeight-1);
SelectPic(GelWindow);
end;
macro 'Plot Overlayed [O]';
var
left,top,width,height:integer;
begin
if (GelWidth=0) or (nPics=1) then begin
PutMessage('Use Setup first.');
Exit;
end;
if PlotColor=1 then SetPalette('256 Color Spectrum');
GetRoi(left,top,width,height);
MakeRoi(RoiLeft,top,RoiWidth,height);
ColumnAveragePlot;
Copy;
SelectPic(PlotWindow);
if PlotColor=1 then SetPalette('256 Color Spectrum');
SetForegroundColor(PlotColor);
PlotTop:=PlotTop-PlotHeight+1);
if PlotTop<SavePlotTop then PlotTop:=SavePlotTop;
MakeRoi(PlotLeft,PlotTop,PlotWidth+LeftMargin+RightMargin,
PlotHeight+TopMargin+BottomMargin);
Paste;
DoOr;
PlotTop:=PlotTop+PlotHeight-1);
SelectPic(GelWindow);
PlotColor:=(PlotColor+74) mod 254;
end;